package com.inossem.warehousestorage_inossem.request.refundStorage;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.refundStorage.RefundStorageReservedListBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * 作者：wsy on 2017/12/26 09:48
 * <p>
 * 邮箱：445979770@qq.com
 */

public class RefundStorageReservedListRequest extends Request {

    private static final String RESERVED_NUMBER = "refer_receipt_code";//预留单号

    public static String request(Context context, String reservedNumber, GsonBeanListener gsonBeanListener) {
        String tag;
        Map<String, String> params = new HashMap<>();
        params.put(RESERVED_NUMBER, reservedNumber);
        String url = RequestManage.getUrl(context, RequestConstant.URL_REFUND_STORAGE_RESERVED_LIST + RequestManage.mapEncodeToParams(params));
        tag = RequestManage.getHttpsGetWithLoading(context, url, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                RefundStorageReservedListBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), RefundStorageReservedListBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }
}
